package com.fdb.efp.nls.service.impl;

import com.fdb.basic.framework.core.base.FrameworkService;
import com.fdb.efp.nls.service.dao.FreezFlowBasiDao;
import com.fdb.efp.nls.service.domain.FreezFlowBasi;
import com.fdb.efp.nls.service.facade.FreezFlowBasiService;
import com.fdb.efp.nls.service.vo.FreezFlowBasiVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * 冻结流水号基本表实现类
 * 
 * @author liyakui
 * @since 2019年1月11日 下午3:50:08
 * @version 1.0
 */
@Service("freezFlowBasiService")
public class FreezFlowBasiServiceImpl implements FreezFlowBasiService, FrameworkService {
	Logger logger = LoggerFactory.getLogger(FreezFlowBasiServiceImpl.class);
	@Autowired
	private FreezFlowBasiDao freezFlowBasiDao;

	@Override
	public int insert(FreezFlowBasiVo freezFlowBasiVo) {
		logger.info("插入数据开始！参数：" + freezFlowBasiVo);
		int count = 0;
		try {
			FreezFlowBasi freezFlowBasi = new FreezFlowBasi();
			beanCopy(freezFlowBasiVo, freezFlowBasi);
			count = freezFlowBasiDao.insert(freezFlowBasi);
			logger.info("插入数据成功！插入条数：" + count);
		} catch (Exception e) {
			e.printStackTrace();
			count = -1;
		}

		return count;
	}

	@Override
	public int deleteFreezFlowBasi(FreezFlowBasiVo freezFlowBasiVo) {
		logger.info("删除数据开始！参数：" + freezFlowBasiVo);
		int count = 0;
		try {
			FreezFlowBasi freezFlowBasi = new FreezFlowBasi();
			beanCopy(freezFlowBasiVo, freezFlowBasi);
			count = freezFlowBasiDao.deleteFreezFlowBasi(freezFlowBasi);
			logger.info("删除成功！删除条数：" + count);
		} catch (Exception e) {
			e.printStackTrace();
			count = -1;
		}

		return count;
	}

	/**
	 * 
	 * 查询冻结流水配置表
	 * 
	 * @param freezFlowBasiVo
	 * @return
	 * @throws Exception
	 * @author liyakui
	 * @since 2019年1月26日 下午5:39:14
	 * @version 1.0
	 */
	@Override
	public FreezFlowBasiVo selectFreezFlowBasi(FreezFlowBasiVo freezFlowBasiVo) throws Exception {
		logger.info("查询数据开始！查询参数：" + freezFlowBasiVo);
		FreezFlowBasiVo freezFlowBasiVo2 = null;
		try {
			FreezFlowBasi freezFlowBasi = new FreezFlowBasi();
			beanCopy(freezFlowBasiVo, freezFlowBasi);
			FreezFlowBasi freezFlowBasi2 = freezFlowBasiDao.selectFreezFlowBasi(freezFlowBasi);
			freezFlowBasiVo2 = beanCopy(freezFlowBasi2, new FreezFlowBasiVo());
			logger.info("查询成功！查询返回结果：" + freezFlowBasiVo2);
		} catch (Exception e) {
			logger.debug("查询数据异常！" + e.getMessage());
			throw e;

		}

		return freezFlowBasiVo2;
	}

	/**
	 * 
	 * 更新冻结流水配置表
	 * 
	 * @param freezFlowBasiVo
	 * @return
	 * @throws Exception
	 * @author liyakui
	 * @since 2019年1月26日 下午5:40:38
	 * @version 1.0
	 */
	@Override
	public int updateFreezFlowBasi(FreezFlowBasiVo freezFlowBasiVo) throws Exception {
		logger.info("更新冻结流水配置表开始！参数：" + freezFlowBasiVo);
		int count = 0;
		try {
			FreezFlowBasi freezFlowBasi = new FreezFlowBasi();
			beanCopy(freezFlowBasiVo, freezFlowBasi);
			count = freezFlowBasiDao.updateFreezFlowBasi(freezFlowBasi);
			logger.info("更新冻结流水配置表成功！条数：" + count);
		} catch (Exception e) {
			logger.debug("更新冻结流水配置表异常！" + e.getMessage());
			throw e;
		}
		return count;
	}

	@Override
	public int insertSelective(FreezFlowBasiVo freezFlowBasiVo) {
		// TODO Auto-generated method stub
		return 0;
	}


}
